package com.itqf.xiaomi.controller;

import com.itqf.xiaomi.dto.UsersDto;
import com.itqf.xiaomi.service.UserService;
import com.itqf.xiaomi.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * projectName: springboot_part
 *
 * @author: 赵伟风
 * time: 2021/9/26 14:26
 * description:  用户对应的接口controller
 */
@RestController
@CrossOrigin("*")
@RequestMapping("users")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 登录接口
     * @param usersDto
     * @return
     */
    @PostMapping("login")
    public Object login(@RequestBody UsersDto usersDto){
        R r = userService.login(usersDto);
        return r;
    }
    /**
     * 检查用户是否可以注册接口
     * @param usersDto
     * @return
     */
    @PostMapping("findUserName")
    public Object findUserName(@RequestBody UsersDto usersDto){
        R r = userService.findUserName(usersDto);
        return r;
    }
    /**
     * 注册接口
     * @param usersDto
     * @return
     */
    @PostMapping("register")
    public Object register(@RequestBody UsersDto usersDto){
        R r = userService.register(usersDto);
        return r;
    }



}
